<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [ <!ENTITY copy "©"> ]>

<!-- \file CUnit-Run.xsl                                                     -->
<!--                                                                         -->
<!-- Copyright (c) 2008 Meadhbh Hamrick, All Rights Reserved                 -->
<!--                                                                         -->
<!-- Insert License Here                                                     -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="CUNIT_TEST_RUN_REPORT">
    <html>
      <head>
	    <title>MUtil Test Summary</title>
		<link rel="stylesheet" href="doc/CUnit-Run.css" type="text/css"/>
      </head>
      <body>
      	<table width="100%">
	  	  <xsl:apply-templates/>
      	</table>		  
      </body>
    </html>
  </xsl:template>
	 	
  <xsl:template match="CUNIT_HEADER">
    <tr>
	  <td class="boxlight" colspan="2">
	    <table width="100%">
	      <tr>
	        <td class="title">MUtil Test Summary</td>
	        <td class="title" width="30%">built with <a href="http://cunit.sourceforge.net/ ">CUnit</a></td>
	      </tr>
	    </table>
	  </td>
    </tr>
  </xsl:template>
	 	
  <xsl:template match="CUNIT_RESULT_LISTING">
    <tr id="middle">
	  <td class="boxlight" valign="top">
	    <table width="100%" height="100%">
	      <tr>
	        <td class="title" colspan="3">Tests and Suites</td>
	      </tr>
			<xsl:apply-templates/>
	    </table>
	  </td>
    </tr>
  </xsl:template>

  <xsl:template match="CUNIT_RUN_SUITE">
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="SUITE_NAME">
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_SUITE_SUCCESS">
    <tr>
      <td class="suitesuccess" colspan="3">Suite :<xsl:value-of select="SUITE_NAME"/></td>
    </tr>
    <xsl:apply-templates/>
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_GROUP">
    <xsl:apply-templates/>
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_GROUP_SUCCESS">
    <tr>
      <td class="suitesuccess">Group :<xsl:apply-templates/></td>
	  <xsl:apply-templates/>
	</tr>
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_TEST_RECORD">
	<xsl:apply-templates/>
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_TEST_SUCCESS">
	<tr>
	  <td width="20%"> </td>
	  <td class="testsuccess"><xsl:apply-templates/></td>
	  <td class="testsuccess">Passed</td>
	</tr>	
  </xsl:template>
	
  <xsl:template match="CUNIT_RUN_SUITE_FAILURE">
    <tr>
      <td class="suitefailure" colspan="2">Suite :<xsl:value-of select="SUITE_NAME"/></td>
      <td class="suitefailure"><xsl:value-of select="FAILURE_REASON"/></td>
	  <xsl:apply-templates/>
	</tr>
  </xsl:template>
  
  <xsl:template match="CUNIT_RUN_TEST_FAILURE">
  	<tr>
	  <td width="20%"> </td>
	  <td class="testfailure"><xsl:value-of select="TEST_NAME"/></td>
	  <td class="testfailure">Failed</td>
	</tr>
	<tr>
	  <td width="20%"> </td>
	  <td class="testfailure"><xsl:value-of select="TEST_NAME"/> <xsl:value-of select="FILE_NAME"/> <xsl:value-of select="LINE_NUMBER"/> <xsl:value-of select="CONDITION"/></td>
	  <td class="testfailure">Failed</td>
	</tr>
  </xsl:template>
	
	<xsl:template match="CUNIT_RUN_GROUP_FAILURE">
		<tr>
			<td colspan="3" bgcolor="#f0b0f0">Running Group <xsl:value-of select="GROUP_NAME"/>... </td>
			<td bgcolor="#ff7070"> <xsl:value-of select="FAILURE_REASON"/> </td>
		</tr>	
	</xsl:template>
	
  <xsl:template match="CUNIT_RUN_SUMMARY">
    <tr id="summary">
	  <td class="boxlight" valign="top">
	    <table width="100%" height="100%">
	      <tr>
	        <td class="title" colspan="5">Summary</td>
	      </tr>
	      <tr> 
			<th width="20%" class="summaryhead"> Type </th>
			<th width="20%" class="summaryhead"> Total </th>
			<th width="20%" class="summaryhead"> Run </th>
			<th width="20%" class="summaryhead"> Succeeded </th>
			<th width="20%" class="summaryhead"> Failed </th>
		  </tr>
		  <xsl:for-each select="CUNIT_RUN_SUMMARY_RECORD">
            <tr>
			  <td class="summarybody"> <xsl:value-of select="TYPE" /> </td>
			  <td class="summarybody"> <xsl:value-of select="TOTAL" /> </td>
			  <td class="summarybody"> <xsl:value-of select="RUN" /> </td>
			  <td class="summarybody"> <xsl:value-of select="SUCCEEDED" /> </td>
			  <td class="summarybody"> <xsl:value-of select="FAILED" /> </td>
			</tr>
		  </xsl:for-each>	
	    </table>
	  </td>
    </tr>
  </xsl:template>
	
  <xsl:template match="CUNIT_FOOTER">
    <tr>
	  <td class="boxlight" colspan="2">
	    <table width="100%">
		  <tr>
		    <td class="footer" width="100%" colspan="2"><xsl:apply-templates/></td>
		  </tr>
	  	</table>
	  </td>
    </tr>
  </xsl:template>
 	
</xsl:stylesheet>
